/**
 * 
 */
package com.wolfpire.proms.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wolfpire.system.common.Constants;

/**
 * 任务模型
 * @author lihd
 *
 */

@Entity
@Table(name = "t_task")
public class Task implements Serializable {
	
	private static final long serialVersionUID = -2649522573390781395L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false, length = 16)
	private Long id;//主键Id
	
	@Column(name = "name", length = 255)
	private String name;//名称(主题)
	
	@Column(name = "project_index_id", length = 16)
	private Long projectIndexId; // 所属指标
	
	@Column(name = "remark", length = 255)
	private String remark; //内容
	
	@Column(name = "plan_amount", length = 20)
	private String planAmount;// 计划使用资金
	
	@Column(name = "fact_amount", length = 20)
	private String factAmount;// 实际使用资金
	
	@Column(name = "progress")
	private Double progress; //进度(任务反馈后回写进来)
	
	@Column(name = "status", length = 2)
	private Integer status;//任务状态 
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "start_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date startTime;//计划开始时间
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "end_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date endTime;//计划结束时间
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date createTime = new Date();//创建时间
	
	@Column(name = "create_user_id")
	private Long createUserId;
	
	@Column(name = "create_user_name")
	private String createUserName;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date updateTime;//修改时间
	
	@Column(name = "update_user_id")
	private Long updateUserId;
	
	@Column(name = "update_user_name")
	private String updateUserName;
	
	@Column(name = "del_flag", length = 1)
	private Integer delFlag = Constants.NORMAL_FLAG;
	
	@Column(name = "fund_sources", length = 16)
	private String fundSources; //资金来源(合集用","隔开)
	
	@Column(name = "task_actor_ids", length = 4000)
	private String taskActorIds; //参与者Id
	
	@Column(name = "task_actor_names", length = 4000)
	private String taskActorNames; //参与者名称
	
	@Column(name = "invalid_user_id", length = 16)
	private Long invalidUserId; //作废人Id
	
	@Column(name = "invalid_user_name", length = 50)
	private String invalidUserName; // 作废人
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "invalid_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date invalidTime; //作废时间
	
	@Transient
	private String projectIndexName;
	
	@Transient
	private Long[] attId;// 附件
	
	@Transient
	private String activityName; //当前任务审批节点
	
	@Transient
	private Long processUserId; //当前任务办理人
	
	@Transient
	private String processUserName;
	
	@Transient
	private String[] fundSourcesArray; //资金来源集合
	
	@Transient
	private String progressStatus; //进度状态[1:0%-25%;2:25%-50%;3:50%-75%;4:75%-99.99%;5:已完成(100%)]
	
	@Transient
	private String taskPlanIdsStr; //任务计划Id串
	
	@Transient
	private Long[] taskPlanIds;//任务计划Id集合

	public Long getProcessUserId() {
		return processUserId;
	}

	public void setProcessUserId(Long processUserId) {
		this.processUserId = processUserId;
	}

	public String getProcessUserName() {
		return processUserName;
	}

	public void setProcessUserName(String processUserName) {
		this.processUserName = processUserName;
	}

	public String getActivityName() {
		return activityName;
	}

	public void setActivityName(String activityName) {
		this.activityName = activityName;
	}

	public Task() {
		super();
	}

	public Task(String name, Long projectIndexId, String remark,
			String planAmount, String factAmount, Integer status,
			Date startTime, Date endTime, Date createTime, Long createUserId,
			String createUserName, Date updateTime, Long updateUserId,
			String updateUserName, String fundSources) {
		super();
		this.name = name;
		this.projectIndexId = projectIndexId;
		this.remark = remark;
		this.planAmount = planAmount;
		this.factAmount = factAmount;
		this.status = status;
		this.startTime = startTime;
		this.endTime = endTime;
		this.createTime = createTime;
		this.createUserId = createUserId;
		this.createUserName = createUserName;
		this.updateTime = updateTime;
		this.updateUserId = updateUserId;
		this.updateUserName = updateUserName;
		this.fundSources = fundSources;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getProjectIndexId() {
		return projectIndexId;
	}

	public void setProjectIndexId(Long projectIndexId) {
		this.projectIndexId = projectIndexId;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getPlanAmount() {
		return planAmount;
	}

	public void setPlanAmount(String planAmount) {
		this.planAmount = planAmount;
	}

	public String getFactAmount() {
		return factAmount;
	}

	public void setFactAmount(String factAmount) {
		this.factAmount = factAmount;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Integer getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(Integer delFlag) {
		this.delFlag = delFlag;
	}

	public String getProjectIndexName() {
		return projectIndexName;
	}

	public void setProjectIndexName(String projectIndexName) {
		this.projectIndexName = projectIndexName;
	}

	public Long[] getAttId() {
		return attId;
	}

	public void setAttId(Long[] attId) {
		this.attId = attId;
	}

	public Long getCreateUserId() {
		return createUserId;
	}

	public void setCreateUserId(Long createUserId) {
		this.createUserId = createUserId;
	}

	public String getCreateUserName() {
		return createUserName;
	}

	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}

	public Long getUpdateUserId() {
		return updateUserId;
	}

	public void setUpdateUserId(Long updateUserId) {
		this.updateUserId = updateUserId;
	}

	public String getUpdateUserName() {
		return updateUserName;
	}

	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}

	public String getFundSources() {
		return fundSources;
	}

	public void setFundSources(String fundSources) {
		this.fundSources = fundSources;
	}

	public String[] getFundSourcesArray() {
		if (!StringUtils.isBlank(this.fundSources)) {
			this.fundSourcesArray = this.fundSources.split(",");
		}
		return fundSourcesArray;
	}

	public void setFundSourcesArray(String[] fundSourcesArray) {
		this.fundSourcesArray = fundSourcesArray;
	}

	/*public String getProgress() {
		return progress;
	}

	public void setProgress(String progress) {
		this.progress = progress;
	}*/

	public String getTaskActorIds() {
		return taskActorIds;
	}

	public Double getProgress() {
		return progress;
	}

	public void setProgress(Double progress) {
		this.progress = progress;
	}

	public void setTaskActorIds(String taskActorIds) {
		this.taskActorIds = taskActorIds;
	}

	public String getTaskActorNames() {
		return taskActorNames;
	}

	public void setTaskActorNames(String taskActorNames) {
		this.taskActorNames = taskActorNames;
	}

	public String getProgressStatus() {
		return progressStatus;
	}

	public void setProgressStatus(String progressStatus) {
		this.progressStatus = progressStatus;
	}

	public String getTaskPlanIdsStr() {
		return taskPlanIdsStr;
	}

	public void setTaskPlanIdsStr(String taskPlanIdsStr) {
		this.taskPlanIdsStr = taskPlanIdsStr;
	}

	public Long[] getTaskPlanIds() {
		return taskPlanIds;
	}

	public void setTaskPlanIds(Long[] taskPlanIds) {
		this.taskPlanIds = taskPlanIds;
	}

	public Long getInvalidUserId() {
		return invalidUserId;
	}

	public void setInvalidUserId(Long invalidUserId) {
		this.invalidUserId = invalidUserId;
	}

	public String getInvalidUserName() {
		return invalidUserName;
	}

	public void setInvalidUserName(String invalidUserName) {
		this.invalidUserName = invalidUserName;
	}

	public Date getInvalidTime() {
		return invalidTime;
	}

	public void setInvalidTime(Date invalidTime) {
		this.invalidTime = invalidTime;
	}

}
